package com.dsj.gxrd.modules.controller.activity;

import com.dsj.gxrd.modules.activity.domain.entity.RdBanner;
import com.dsj.gxrd.modules.activity.domain.entity.RdScore;
import com.dsj.gxrd.modules.activity.service.RdBannerService;
import com.dsj.gxrd.modules.activity.service.RdScoreService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author songpin566
 * @date 2023/09/14
 **/
@RestController
@Api("大政方针")
@RequestMapping("/banner")
public class RdBannerController extends BaseController {

    @Autowired
    private RdBannerService rdBannerService;

    @RequiresPermissions("banner:list")
    @GetMapping("/list")
    public TableDataInfo list(RdBanner banner) {
        startPage();
        List<RdBanner> list = rdBannerService.selectBannerList(banner);
        return getDataTable(list);
    }

    @RequiresPermissions("banner:add")
    @PostMapping()
    public AjaxResult add(@RequestBody RdBanner banner) {
        return toAjax(rdBannerService.insertBanner(banner));
    }

    @RequiresPermissions("banner:edit")
    @PutMapping()
    public AjaxResult edit(@RequestBody RdBanner banner) {
        return toAjax(rdBannerService.updateBanner(banner));
    }

    @RequiresPermissions("banner:del")
    @DeleteMapping("/{ids}")
    public AjaxResult removes(@PathVariable List<Long> ids) {
        return rdBannerService.removes(ids);
    }



}
